package com.bestcem.xm.ticket.service.manager.notify;

import com.bestcem.xm.ticket.enums.TicketNotifyConfigEventEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 工单通知 可用的自定义字段 常量
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/11/22 14:56
 */
public class FiledConstant {
    /**
     * 工单 邮件 模板字段数据映射
     */
    public static class Email {
        public static final String SURVEY_NAME = "${问卷名称}";
        public static final String PROJECT_NAME = "${项目名称}";
        public static final String SYSTEM_NAME = "${系统名称}";

        public static final String RULE_NAME = "${规则/工单名称}";
        public static final String TICKET_NO = "${编号}";
        public static final String URL = "${工单预警详情链接}";
        public static final String CREATE_TIME = "${生成时间}";
        public static final String FOLLOW_OVERDUE_TIME = "${处理逾期时间}";
        public static final String TRIGGER_NAME = "${触发条件名称}";

        public static final String SEND_TIME = "${发邮件日期}";

        /**
         * 用于文字链接提取的正则表达式
         */
        public static final String TEXT_URL_REGEX = "\\$\\{工单预警详情链接=\"(.*?)\"\\}";
        /**
         * 用于问卷题目提取的正则表达式
         */
        public static final String ANSWER_QUESTION_REGEX = "\\$\\{展示答卷题目(.*?)及答案\\}";
    }

    /**
     * 工单 短信 模板字段数据映射
     */
    public static class Sms {
        public static final String SURVEY_NAME = "${问卷名称}";
        public static final String PROJECT_NAME = "${项目名称}";
        public static final String SYSTEM_NAME = "${系统名称}";

        public static final String RULE_NAME = "${规则/工单名称}";
        public static final String TICKET_NO = "${编号}";
        public static final String URL = "${工单预警详情链接}";
        public static final String CREATE_TIME = "${生成时间}";
        public static final String FOLLOW_OVERDUE_TIME = "${处理逾期时间}";
        public static final String TRIGGER_NAME = "${触发条件名称}";
    }

    /**
     * 工单 飞书 模板字段数据映射
     */
    public static class FeiShu {
        public static final String PROJECT_NAME = "${项目名称}";
        public static final String TICKET_NO = "${编号}";
        public static final String FOLLOW_OVERDUE_TIME = "${处理逾期时间}";
        public static final String TICKET_CONFIG_NAME = "${规则/工单名称}";
        public static final String TRIGGER_NAME = "${触发条件名称}";
        public static final String URL = "${工单预警详情链接}";
    }

    /**
     * 工单 钉钉 模板字段数据映射
     */
    public static class DingTalk {
        /**
         * 问卷项目标题
         */
        public static final String SURVEY_TITLE = "surveyTitle";
        /**
         * 工单编号
         */
        public static final String TICKET_NO = "ticketNo";
        /**
         * 触发规则名称
         */
        public static final String TICKET_CONFIG_NAME = "ticketConfigName";
        /**
         * 逾期时间
         */
        public static final String OVERDUE_TIME = "followOverdueTime";
        /**
         * 跳转链接
         */
        public static final String TICKET_URL = "ticketUrl";
        /**
         * 触发条件名称
         */
        public static final String TRIGGER_NAME = "triggerName";
    }

    /**
     * 工单 企业微信 模板字段数据映射
     */
    public static class WechatWork {
        /**
         * 项目名称
         */
        public static final String SURVEY_TITLE = "所属项目";
        /**
         * 工单编号
         */
        public static final String TICKET_NO = "工单编号";
        /**
         * 工单编号
         */
        public static final String ONLY_NOTIFY_NO = "预警编号";
        /**
         * 规则名称/工单名称
         */
        public static final String TICKET_CONFIG_NAME = "规则/工单名称";
        /**
         * 逾期时间
         */
        public static final String OVERDUE_TIME = "逾期时间";
        /**
         * 触发条件名称
         */
        public static final String TRIGGER_NAME = "触发条件名称";


        /**
         * 消息卡片标题
         */
        public static final Map<TicketNotifyConfigEventEnum, String> TITLE_MAP = new HashMap<>();

        static {
            TITLE_MAP.put(TicketNotifyConfigEventEnum.CREATED_TICKET, "收到工单");
            TITLE_MAP.put(TicketNotifyConfigEventEnum.FOLLOW_REMIND, "工单跟进即将逾期");
            TITLE_MAP.put(TicketNotifyConfigEventEnum.FOLLOW_OVERDUE, "工单跟进已经逾期");
            TITLE_MAP.put(TicketNotifyConfigEventEnum.ONLY_NOTIFY, "收到预警");
        }
    }
}
